#pragma once
#include "cdibox.h"

class CdiRenderList;

class CdiRenderBox :
  public CdiBox
{
private: 
  // Member Variables
  LPDIRECT3DVERTEXBUFFER9 m_vertexBuffer;
  LPDIRECT3DINDEXBUFFER9  m_pIndexBuffer;
  CdiRenderList*          m_objectList;
  D3DPRIMITIVETYPE        m_primitiveType;

private:
  // Setup the Render BoxBox
  void Setup();

  // Create the Vertex Buffers
  HRESULT CreateVertexBuffer();

public:

  // 
  CdiRenderBox(LPDIRECT3DDEVICE9 pDevice, float scale);
  
  virtual ~CdiRenderBox(void);
  
  // Render
  HRESULT Render( LPDIRECT3DDEVICE9 pDevice = NULL );

  // Can Render
  BOOL CanRender() const;

  // Add a box
  HRESULT Attach( CdiBox& box );

  // Render State
  BOOL SetRender( BOOL renderState );

  inline CdiRenderList* GetAttachedObjects() const { return m_objectList; }

  void SetRenderType( D3DPRIMITIVETYPE primitiveType );

protected:
  CdiRenderBox( const CdiRenderBox& );

  CdiRenderBox operator =( const CdiRenderBox& );
};
